home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 1.5 KB | 43 lines | [TEXT/GEOL] |
- Item 4258841 9-Aug-90 14:58PDT
-
- From: MM.XOBJ MacroMind, Haim Zamir,PRT
-
- To: CPLUS.DEV$ C++ Interest List--Developers
- CPLUS.APPLE$ C++ Interest List--Apple Employees
-
- Sub: operator== and operator!=
-
- C++ folks:
-
- I have defined an operator== for a type. I checked the C output to see what
- happens if I do a !=. It turns out that the reverse of some default equality
- operator is used instead of the reverse of the operator== I provide. OK, so I
- provide an explicit operator!= also. The AT&T reference manual and Lippman,
- however, are mute on this subject. (Except that the AT&T manual explicitly
- says that operator= (assignment) is the ONLY one that has a default operator
- created for it. What gives?
-
- What is worse, the construct
-
- if(type)
- ...
-
- will not yield the equivalent of "if(type != 0)" and even with an operator!=,
- the expression "if(!type)" won;t yield the equivalent of "if(type == 0)"
-
- I have resorted to doing these tests on types since the types are smart
- pointers (in reality complex structures) that I use to point to other types.
- It is important to reliably check them against null, and compare them against
- other types. In other respects they really do feal like pointers.
-
- Does anyone know of other limitations that I may not have caught for these
- particular overloads, or significant others related to pointers?
-
-
- Overloaded, I remain,
-
- Haim Zamir
- MacroMind, Inc.
- AppleLink MM.XOBJ
-
-